﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace CommunitySystemModel
{
    public class CanGongModel
    {
        private int _Sec;
        [DataMember]
        public int Sec
        {
            get { return _Sec; }
            set { _Sec = value; }
        }
        private int _ID;
        [DataMember]
        public int ID
        {
            get { return _ID; }
            set { _ID = value; }
        }
        private int _ShangJiOrgID;
        [DataMember]
        public int ShangJiOrgID
        {
            get { return _ShangJiOrgID; }
            set { _ShangJiOrgID = value; }
        }
        private string _ShangJiName;
        [DataMember]
        public string ShangJiName
        {
            get { return _ShangJiName; }
            set { _ShangJiName = value; }
        }

        private string _Status;
        [DataMember]
        public string Status
        {
            get { return _Status; }
            set { _Status = value; }
        }

        private string _Name;
        [DataMember]
        public string Name
        {
            get { return _Name; }
            set { _Name = value; }
        }
        private int _Nian;
        [DataMember]
        public int Nian
        {
            get { return _Nian; }
            set { _Nian = value; }
        }
        private DateTime? _QueRenDate;
        [DataMember]
        public DateTime? QueRenDate
        {
            get { return _QueRenDate; }
            set { _QueRenDate = value; }
        }

        private DateTime? _CreateDate;
        [DataMember]
        public DateTime? CreateDate
        {
            get { return _CreateDate; }
            set { _CreateDate = value; }
        }
        private int _OrgID;
        [DataMember]
        public int OrgID
        {
            get { return _OrgID; }
            set { _OrgID = value; }
        }
        public static CanGongModel FillEntity(DataRow dr)
        {
            CanGongModel right = new CanGongModel();
            if (dr.Table != null && dr.Table.Columns.Contains("Sec")) if (!string.IsNullOrEmpty(dr["Sec"].ToString())) right.Sec = Convert.ToInt32(dr["Sec"]);
            if (dr.Table != null && dr.Table.Columns.Contains("ID")) if (!string.IsNullOrEmpty(dr["ID"].ToString())) right.ID = Convert.ToInt32(dr["ID"]);
            if (dr.Table != null && dr.Table.Columns.Contains("Status")) if (!string.IsNullOrEmpty(dr["Status"].ToString())) right.Status = dr["Status"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("ShangJiOrgID")) if (!string.IsNullOrEmpty(dr["ShangJiOrgID"].ToString())) right.ShangJiOrgID = Convert.ToInt32(dr["ShangJiOrgID"]);
            if (dr.Table != null && dr.Table.Columns.Contains("Nian")) if (!string.IsNullOrEmpty(dr["Nian"].ToString())) right.Nian = Convert.ToInt32(dr["Nian"]);

            if (dr.Table != null && dr.Table.Columns.Contains("ShangJiName")) if (!string.IsNullOrEmpty(dr["ShangJiName"].ToString())) right.ShangJiName = dr["ShangJiName"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("Name")) if (!string.IsNullOrEmpty(dr["Name"].ToString())) right.Name = dr["Name"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("QueRenDate")) if (!string.IsNullOrEmpty(dr["QueRenDate"].ToString()) && Convert.ToDateTime(dr["QueRenDate"]) != Convert.ToDateTime("1900-01-01")) right.QueRenDate = Convert.ToDateTime(dr["QueRenDate"]);
            if (dr.Table != null && dr.Table.Columns.Contains("CreateDate")) if (!string.IsNullOrEmpty(dr["CreateDate"].ToString()) && Convert.ToDateTime(dr["CreateDate"]) != Convert.ToDateTime("1900-01-01")) right.CreateDate = Convert.ToDateTime(dr["CreateDate"]);
            if (dr.Table != null && dr.Table.Columns.Contains("OrgID")) if (!string.IsNullOrEmpty(dr["OrgID"].ToString())) right.OrgID = Convert.ToInt32(dr["OrgID"]);
            return right;
        }
    }
}
